package com.wu.shop.module.main.ui.adapter

import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.wu.shop.module.classify.ui.fragment.ClassifyFragment
import com.wu.shop.module.coordinatorLayout.ui.CoordinatorLayoutRecycleViewFragment
import com.wu.shop.module.home.ui.fragment.HomeFragment
import com.wu.shop.module.mine.ui.fragment.MineFragment
import com.wu.shop.module.shop.ui.fragment.ShopCarFragment

/**
 * 作者:吴奎庆
 *
 *
 * 时间:2019-12-21
 *
 *
 * 用途:
 */
class HomeFragmentPagerAdapter(
    var context: Context,
    fm: FragmentManager
) : FragmentPagerAdapter(fm) {
    override fun getItem(position: Int): Fragment {
        var fragment: Fragment? = null
        when (position) {
            0 -> fragment = CoordinatorLayoutRecycleViewFragment.newInstance()
//            0 -> fragment = CoordinatorLayoutFragment.newInstance()
//            0 -> fragment = HomeFragment.newInstance()
            1 -> fragment = ClassifyFragment.newInstance()
            2 -> fragment = ShopCarFragment.newInstance()
            3 -> fragment = MineFragment.newInstance()
        }
        return fragment!!
    }

    override fun getCount(): Int {
        return 4
    }

}